package pl.uz.zgora.plan;

import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Locale;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class DayViewActivity extends TabActivity {
	
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.week_view);
	    
	    Resources res = getResources();
	    final TabHost tabHost = getTabHost();  // The activity TabHost
	    {
	    	Calendar calendar = Calendar.getInstance();
	    	String dayNames[] = new DateFormatSymbols(new Locale("pl")).getWeekdays();
	    	String dayOfWeek = dayNames[calendar.get(Calendar.DAY_OF_WEEK)];
	    	dayOfWeek =  dayOfWeek.substring(0,1).toUpperCase() + dayOfWeek.substring(1).toLowerCase();
	    	// Create an Intent to launch an Activity for the tab (to be reused)
		    final Intent intent = new Intent(this, TimeTableActivity.class);
		    intent.putExtra("day", dayOfWeek);
		    intent.putExtra("weekview", false);
		    tabHost.addTab(tabHost.newTabSpec(dayOfWeek
		    		.toLowerCase()).
		    		setIndicator(dayOfWeek, res.getDrawable(R.drawable.oneday)).
		    		setContent(intent));
	    }
	    tabHost.setCurrentTab(0);
	}
	
	
}
